<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="_token" content="{{ csrf_token() }}"/>
    <title>IP用户管理后台</title>
    <link rel="Shortcut Icon" href="{{asset('admin_assets/img/HB.ico') }}"/>
    <link rel="Bookmark" href="{{asset('admin_assets/img/HB.ico') }}" />
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <link rel="stylesheet" href="{{asset('admin_assets/css/bootstrap.min.css')}}">
    <link rel="stylesheet" type="text/css" href="{{asset('admin_assets/css/font-awesome/css/font-awesome.min.css')}}">
    <link rel="stylesheet" href="{{asset('admin_assets/css/AdminLTE.min.css')}}">
    <link rel="stylesheet" href="{{asset('admin_assets/css/skins/_all-skins.min.css')}}">
    <link rel="stylesheet" href="{{asset('admin_assets/css/bootstrap-datetimepicker.min.css')}}">
    <style>
        .error {
            color: #f40d00;
            display: none;
        }
    </style>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper" style="background: white;">
    <header class="main-header">
        <a href="#" class="logo" style="background-color: #303643">
      <span class="logo-mini" style="background-color: #303643">
        <img src="{{asset('admin_assets/img/minilogo.png')}}" style="width: 40px;height: 40px">
      </span>
      <span class="logo-lg" style="background-color: #303643">
        <img src="{{asset('admin_assets/img/iplogo.png')}}" style="width: 150px;height: 35px">
      </span>
        </a>
        <nav class="navbar navbar-static-top" style="background-color: #303643">
            <div class="navbar-custom-menu">
                <ul class="nav navbar-nav">
                    <li class="dropdown user user-menu">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                            <img src="{{asset('admin_assets/img/minilogo.png')}}" class="user-image"
                                 alt="">
                            <span class="hidden-xs">用户管理员</span>
                        </a>
                        <ul class="dropdown-menu">
                            <li class="user-header" style="background: #222D32">
                                <div style="margin-left: 35%;width: 80px;height: 80px;border-radius: 50%;">
                                    <img src="{{asset('admin_assets/img/minilogo.png')}}" style="width: 80px;height: 80px">
                                </div>
                                <p style="margin-top: 10%">SOVO</p>
                            </li>
                            <li class="user-body">
                                <div class="row">
                                    <div class="col-xs-6 text-center">
                                        <a href="{{url('management/business/userInfo')}}">个人中心</a>
                                    </div>
                                    <div class="col-xs-6 text-center">
                                        <a href="{{url('management/business/changePassword')}}">修改密码</a>
                                    </div>
                                </div>

                            </li>
                            <li class="user-footer">
                                <div class="pull-right">
                                    <a href="{{url('management/business/loginOut')}}" class="btn btn-default btn-flat">退出登录</a>
                                </div>
                            </li>
                        </ul>
                    </li>
                </ul>
            </div>
        </nav>
    </header>
    <div class="content-wrapper" style="background-color: white;width: 100%;margin-left: 0">
        <section class="content">
            <div class="row">
                <div class="col-lg-10 col-md-10 col-sm-10 col-xs-12 col-lg-offset-1 col-md-offset-1 col-sm-offset-1">
                    <div class="box box-info"
                         style="padding-top: 0px;margin-top: 0px;border-top: 0px;border-bottom: solid 1px #0080ff;">
                        <div class="box-body">
                            <div class="row">
                                <div class="col-lg-3 col-md-3 col-sm-12 col-xs-12" style="margin-top: 0.5vw">
                                    <a href="{{url('management/business/index')}}" title="返回首页"><i
                                                class="fa fa-home fa-2x"
                                                style="width: 100%;color: #0080FF">
                                            <span style="font-size: 1.2vw">&nbsp;修改密码</span></i></a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            @include('public/alert')
            <div class="row">
                <div class="col-lg-8 col-md-8 col-sm-10 col-xs-12 col-lg-offset-2 col-md-offset-2 col-sm-offset-1">
                    <h3 style="text-align: center;color: #676767">修改密码</h3>
                    <form action="{{url('management/business/doChangePassword')}}" method="post" enctype="multipart/form-data" style="width: 100%">
                        {{csrf_field()}}
                        <div class="row" style="margin-top: 2%">
                            <div class="col-lg-4 col-md-4 col-sm-12 col-xs-12 col-lg-offset-4 col-md-offset-4">
                                <input id="hide_pwd" value="{{$data}}" type="hidden">
                                <input type="password" class="form-control" placeholder="旧密码:" id="old_pwd" name="old_pwd"  style="border-radius: 5px" onblur="checkOld();">
                                <p class="error" id="old_empty"><i class="fa fa-close"></i>旧密码为空</p>
                                <p class="error" id="old_error"><i class="fa fa-close"></i>旧密码输入错误</p>
                            </div>
                        </div>
                        <div class="row" style="margin-top: 2%">
                            <div class="col-lg-4 col-md-4 col-sm-12 col-xs-12 col-lg-offset-4 col-md-offset-4">
                                <input type="password" class="form-control" placeholder="新密码:" id="new_pwd" name="new_pwd"  style="border-radius: 5px" onblur="checkNew();">
                                <p class="error" id="new_empty"><i class="fa fa-close"></i>新密码为空</p>
                                <p class="error" id="new_equal"><i class="fa fa-close"></i>新密码与旧密码相同</p>
                            </div>
                        </div>
                        <div class="row" style="margin-top: 2%">
                            <div class="col-lg-4 col-md-4 col-sm-12 col-xs-12 col-lg-offset-4 col-md-offset-4">
                                <input type="password" class="form-control" placeholder="确认密码:" id="require_pwd" name="require_pwd"  style="border-radius: 5px" onblur="checkreq();">
                                <p class="error" id="require_empty"><i class="fa fa-close"></i>确认密码为空</p>
                                <p class="error" id="require_error"><i class="fa fa-close"></i>确认密码与新密码不一致</p>
                            </div>
                        </div>
                        <div class="row" style="margin-top: 2%">
                            <div class="col-lg-4 col-md-4 col-sm-12 col-xs-12 col-lg-offset-4 col-md-offset-4">
                                <button type="submit" class="btn btn-info" style="background: #0080ff;width: 100%">提交</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </section>
    </div>
    <footer class="main-footer" style="background-color: #eaeaea;text-align: center; font-size: 0.8vw;;margin-left: 0">
        Copyright &copy; 2018 <a href="http://www.hongbung.com" target="_blank">上海宏邦知识产权代理有限公司</a>
    </footer>
</div>
<script src="{{asset('admin_assets/js/jquery.min.js')}}"></script>
<script src="{{asset('admin_assets/js/md5.js')}}"></script>
<script src="{{asset('admin_assets/js/bootstrap.min.js')}}"></script>
<script src="{{asset('admin_assets/js/adminlte.min.js')}}"></script>
<script type="text/javascript" src="{{asset('admin_assets/js/bootstrap-datetimepicker.js')}}" ></script>
<!--底部引入js-->
<script>
    function checkOld() {
        var old = $("#old_pwd").val();
        var newpwd = $("#new_pwd").val();
        var reqpwd=$("#require_pwd").val();
        var hide_pwd=$("#hide_pwd").val();
        console.log($.md5(old),hide_pwd);
        if (old.length == 0) {
            $(".error").css('display', 'none');
            $("#old_empty").css('display', 'block');
            $("#btn").attr('disabled', true);
        }else if(hide_pwd!=$.md5(old)){
            $(".error").css('display', 'none');
            $("#old_error").css('display', 'block');
            $("#btn").attr('disabled', true);
        }else{
            $(".error").css('display', 'none');
            $("#btn").attr('disabled', false);
        }
    }
    function checkNew() {
        var old = $("#old_pwd").val();
        var newpwd = $("#new_pwd").val();
        var reqpwd=$("#require_pwd").val();
        if(newpwd.length==0){
            $(".error").css('display', 'none');
            $("#new_empty").css('display', 'block');
            $("#btn").attr('disabled', true);
        }else if(newpwd==old){
            $(".error").css('display', 'none');
            $("#new_equal").css('display', 'block');
            $("#btn").attr('disabled', true);
        }else {
            $(".error").css('display', 'none');
            $("#btn").attr('disabled', false);
        }
    }
    function checkreq() {
        var old = $("#old_pwd").val();
        var newpwd = $("#new_pwd").val();
        var reqpwd=$("#require_pwd").val();
        if(reqpwd.length==0){
            $(".error").css('display', 'none');
            $("#require_empty").css('display', 'block');
            $("#btn").attr('disabled', true);
        }else if(reqpwd!=newpwd){
            $(".error").css('display', 'none');
            $("#require_error").css('display', 'block');
            $("#btn").attr('disabled', true);
        }else
        {
            $(".error").css('display', 'none');
            $("#btn").attr('disabled', false);
        }
    }
</script>
</body>
</html>
